package com.xh.web.controller;

import java.util.List;

import com.xh.web.constant.AjaxResult;
import com.xh.web.domain.DTableImport;
import com.xh.web.service.IDTableImportService;
import com.xh.web.util.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 导入临时Controller
 * 
 * @author fulan
 * @date 2020-09-14
 */
@RestController
@RequestMapping("/db/import/table")
public class DTableImportController extends BaseController
{
    @Autowired
    private IDTableImportService dTableImportService;

    /**
     * 查询导入临时列表
     */
    @GetMapping("/list")
    public TableDataInfo list(DTableImport dTableImport)
    {
        startPage();
        List<DTableImport> list = dTableImportService.selectDTableImportList(dTableImport);
        return getDataTable(list);
    }

    /**
     * 导出导入临时列表
     */
    @GetMapping("/export")
    public AjaxResult export(DTableImport dTableImport)
    {
        /*List<DTableImport> list = dTableImportService.selectDTableImportList(dTableImport);
        ExcelUtil<DTableImport> util = new ExcelUtil<DTableImport>(DTableImport.class);
        return util.exportExcel(list, "import");*/
        return null;
    }

    /**
     * 获取导入临时详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(dTableImportService.selectDTableImportById(id));
    }

    /**
     * 新增导入临时
     */
    @PostMapping
    public AjaxResult add(@RequestBody DTableImport dTableImport)
    {
        return toAjax(dTableImportService.insertDTableImport(dTableImport));
    }

    /**
     * 修改导入临时
     */
    @PutMapping
    public AjaxResult edit(@RequestBody DTableImport dTableImport)
    {
        return toAjax(dTableImportService.updateDTableImport(dTableImport));
    }

    /**
     * 删除导入临时
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(dTableImportService.deleteDTableImportByIds(ids));
    }
}
